package cc.idoone.joddhttp.demo;

import jodd.http.HttpRequest;
import jodd.http.HttpResponse;

import java.net.SocketException;

/**
 * @author hemj
 * @version 2017/7/31
 */
public class BodyRequestDemo {
    private static final String URL = "http://localhost:8088/joddhttp/test";

    public static void main(String[] args) throws SocketException {
        // body
        // form 被覆盖了
        HttpResponse response = HttpRequest
                .get(URL + "?uid=1")
                .header("myHeader", "Header_-Value@#")
                .query("uname", "hemj")
                .form("formField1", "1")
                .body("{'$user[userId, screenName] = /user/get-user-by-id' : {'userId':'10194'}}")
                .basicAuthentication("test", "test")
                .send();
        System.out.println(response.charset("UTF-8").bodyText());
    }

}
